// 选择题 表
const { STRING, INTEGER, DATE } = require("sequelize")

const sequelize = require("../sequelize");

const Choice = sequelize.define("Choice", {
    title: {
        type: STRING,
        allowNull: false,
        unique: true,
        comment: "选择题 题干"
    },
    options:{
        type:STRING,
        allowNull:false,
        comment:"选项"
    },
    answer:{
        type:STRING,
        allowNull:false,
        comment:"答案"
    },
    creator:{
        type:STRING,
        comment:"创建者"
    },
    createdate:{
        type:DATE,
        comment:"创建时间"
    },
    updator:{
        type:STRING,
        comment:"修改者"
    },
    update:{
        type:DATE,
        comment:"修改时间"
    },
    typeid:{
        type:INTEGER(36),
        comment:"题型"
    }
})


Choice.associate = function(){
    Choice.belongsTo(sequelize.Questiontype,{
        foreginKey:"typeid",
        target:"id"
    })
}



module.exports = Choice